home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 October / Ahoy_Magazine_86-10_1986_Double_L.d64 / Word Wrapper (.txt) < prev   
Commodore BASIC  |  2022-10-26  |  711b  |  23 lines

  1. 0 poke53280,0:poke53281,6:poke646,1
  2. 1 print"[147]commodares problem #30-3"
  3. 2 print"    word wrapper":print
  4. 3 rem solution by
  5. 4 rem     jim speers
  6. 5 rem
  7. 10 l$="[157]":b$=" ":fori=1to79:ll$=ll$+l$:bl$=bl$+b$:next:d$=chr$(20)
  8. 20 q$=chr$(34)+chr$(20)+chr$(34):wl=0:ll=0:c$="[175]":print""c$;
  9. 30 getz$:ifz$="" then 30
  10. 40 if z$="_" then print l$;b$:end
  11. 50 x=asc(z$):if x=32 then wl=0:w$="":ll=ll+1:print l$z$c$;:goto 140
  12. 60 if x=34 then print l$q$c$;:wl=wl+1:ll=ll+1:wl$=wl$+q$:goto 140
  13. 70 if x=13 then print l$b$:print c$;:ll=0:wl=0:w$="":goto 30
  14. 80 if x<>20 then 120
  15. 90 print d$d$c$;:ll=ll-1:if wl>0 then wl=wl-1:w$=left$(w$,len(w$)-1)
  16. 100 if ll<0 then ll=ll+80
  17. 110 goto 30
  18. 120 if (x>16andx<32) or (x>127andx<160) then 30
  19. 130 print l$z$c$;:w$=w$+z$:wl=wl+1:ll=ll+1
  20. 140 if ll<81 then 30
  21. 150 if wl=0 then 30
  22. 160 print left$(ll$,wl+1)left$(bl$,wl-1)w$c$;:ll=wl:goto 30
  23.